<?
load_class('Control_Base');


class Control_Level extends Control_Base {
	
	
	var $_modelLevel;
	var $name;
	var $default;
	var $_ui;

	function Control_Level($name='level',$default=0){
		$this->_modelLevel=&get_singleton('Model_Role');
		$this->_ui=FLEA::initWebControls();

		$this->name = $name;
		$this->default = $default;
	}
	
	function render(){
		
				
		$result = $this->_modelLevel->findAll();
		$items=array();
		
  		$items=array_to_hashmap($result,'rolename','role_id');
  		$items['==Please Select=='] = 0; 
		$selected=$this->default!=''?$this->default:'0';
		$Level=$this->_ui->control("dropdownlist",$this->name,
							array(
  							'items' =>$items,
  							'selected' => $selected,
  							'title' => '',
  							'class' => 'txt',
  							),true
			);
		return $Level;			
	}
	
	
}


?>